# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-keepass
pkgver=4.0.7
pkgrel=2
pkgdesc="Python3 library to interact with keepass databases"
url="https://github.com/libkeepass/pykeepass"
arch="noarch !s390x" # pykeepass test fail on s390x
license="GPL-3.0-only"
depends="
	py3-argon2-cffi
	py3-cffi
	py3-construct
	py3-dateutil
	py3-future
	py3-lxml
	py3-pycryptodomex
	py3-setuptools
	python3
	"
makedepends="
	py3-gpep517
	py3-wheel
	"
checkdepends="py3-otp"
subpackages="$pkgname-pyc"
source="https://github.com/libkeepass/pykeepass/archive/refs/tags/v$pkgver/py3-keepass-$pkgver.tar.gz
	install-kdbx_parsing.patch
	"
builddir="$srcdir/pykeepass-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m unittest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
51d2ade1cc7d3f0c705d39d0ec8a7087995ee6ed9ea573bb87ee8783792709a707230352e572ed0e420cbc8122ae741f4f3c40f5ef8949c53afcb0bc1da2a0fe  py3-keepass-4.0.7.tar.gz
c9f621082e9d944f37237d9ebc280622565eb51706ff53d4ef5ee5f4d0e76dd47bab47e285b637d69ef943c742649d5bc7b0c6149019a3c5ea7b6a7b9b6057da  install-kdbx_parsing.patch
"
